// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by sidekick. DO NOT EDIT.
#![allow(rustdoc::redundant_explicit_links)]
#![allow(rustdoc::broken_intra_doc_links)]

/// Implements a client for the Telco Automation API.
///
/// # Example
/// ```
/// # tokio_test::block_on(async {
/// # use google_cloud_telcoautomation_v1::client::TelcoAutomation;
/// let client = TelcoAutomation::builder().build().await?;
/// // use `client` to make requests to the Telco Automation API.
/// # gax::client_builder::Result::<()>::Ok(()) });
/// ```
///
/// # Service Description
///
/// TelcoAutomation Service manages the control plane cluster a.k.a.
/// Orchestration Cluster (GKE cluster with config controller) of TNA. It also
/// exposes blueprint APIs which manages the lifecycle of blueprints that control
/// the infrastructure setup (e.g GDCE clusters) and deployment of network
/// functions.
///
/// # Configuration
///
/// To configure `TelcoAutomation` use the `with_*` methods in the type returned
/// by [builder()][TelcoAutomation::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://telcoautomation.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::telco_automation::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::telco_automation::ClientBuilder::credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `TelcoAutomation` holds a connection pool internally, it is advised to
/// create one and the reuse it.  You do not need to wrap `TelcoAutomation` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[derive(Clone, Debug)]
pub struct TelcoAutomation {
    inner: std::sync::Arc<dyn super::stub::dynamic::TelcoAutomation>,
}

impl TelcoAutomation {
    /// Returns a builder for [TelcoAutomation].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_telcoautomation_v1::client::TelcoAutomation;
    /// let client = TelcoAutomation::builder().build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub fn builder() -> super::builder::telco_automation::ClientBuilder {
        gax::client_builder::internal::new_builder(
            super::builder::telco_automation::client::Factory,
        )
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::TelcoAutomation + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::TelcoAutomation>>
    {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::TelcoAutomation> {
        super::transport::TelcoAutomation::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> gax::client_builder::Result<impl super::stub::TelcoAutomation> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::TelcoAutomation::new)
    }

    /// Lists OrchestrationClusters in a given project and location.
    pub fn list_orchestration_clusters(
        &self,
    ) -> super::builder::telco_automation::ListOrchestrationClusters {
        super::builder::telco_automation::ListOrchestrationClusters::new(self.inner.clone())
    }

    /// Gets details of a single OrchestrationCluster.
    pub fn get_orchestration_cluster(
        &self,
    ) -> super::builder::telco_automation::GetOrchestrationCluster {
        super::builder::telco_automation::GetOrchestrationCluster::new(self.inner.clone())
    }

    /// Creates a new OrchestrationCluster in a given project and location.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn create_orchestration_cluster(
        &self,
    ) -> super::builder::telco_automation::CreateOrchestrationCluster {
        super::builder::telco_automation::CreateOrchestrationCluster::new(self.inner.clone())
    }

    /// Deletes a single OrchestrationCluster.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_orchestration_cluster(
        &self,
    ) -> super::builder::telco_automation::DeleteOrchestrationCluster {
        super::builder::telco_automation::DeleteOrchestrationCluster::new(self.inner.clone())
    }

    /// Lists EdgeSlms in a given project and location.
    pub fn list_edge_slms(&self) -> super::builder::telco_automation::ListEdgeSlms {
        super::builder::telco_automation::ListEdgeSlms::new(self.inner.clone())
    }

    /// Gets details of a single EdgeSlm.
    pub fn get_edge_slm(&self) -> super::builder::telco_automation::GetEdgeSlm {
        super::builder::telco_automation::GetEdgeSlm::new(self.inner.clone())
    }

    /// Creates a new EdgeSlm in a given project and location.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn create_edge_slm(&self) -> super::builder::telco_automation::CreateEdgeSlm {
        super::builder::telco_automation::CreateEdgeSlm::new(self.inner.clone())
    }

    /// Deletes a single EdgeSlm.
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    pub fn delete_edge_slm(&self) -> super::builder::telco_automation::DeleteEdgeSlm {
        super::builder::telco_automation::DeleteEdgeSlm::new(self.inner.clone())
    }

    /// Creates a blueprint.
    pub fn create_blueprint(&self) -> super::builder::telco_automation::CreateBlueprint {
        super::builder::telco_automation::CreateBlueprint::new(self.inner.clone())
    }

    /// Updates a blueprint.
    pub fn update_blueprint(&self) -> super::builder::telco_automation::UpdateBlueprint {
        super::builder::telco_automation::UpdateBlueprint::new(self.inner.clone())
    }

    /// Returns the requested blueprint.
    pub fn get_blueprint(&self) -> super::builder::telco_automation::GetBlueprint {
        super::builder::telco_automation::GetBlueprint::new(self.inner.clone())
    }

    /// Deletes a blueprint and all its revisions.
    pub fn delete_blueprint(&self) -> super::builder::telco_automation::DeleteBlueprint {
        super::builder::telco_automation::DeleteBlueprint::new(self.inner.clone())
    }

    /// List all blueprints.
    pub fn list_blueprints(&self) -> super::builder::telco_automation::ListBlueprints {
        super::builder::telco_automation::ListBlueprints::new(self.inner.clone())
    }

    /// Approves a blueprint and commits a new revision.
    pub fn approve_blueprint(&self) -> super::builder::telco_automation::ApproveBlueprint {
        super::builder::telco_automation::ApproveBlueprint::new(self.inner.clone())
    }

    /// Proposes a blueprint for approval of changes.
    pub fn propose_blueprint(&self) -> super::builder::telco_automation::ProposeBlueprint {
        super::builder::telco_automation::ProposeBlueprint::new(self.inner.clone())
    }

    /// Rejects a blueprint revision proposal and flips it back to Draft state.
    pub fn reject_blueprint(&self) -> super::builder::telco_automation::RejectBlueprint {
        super::builder::telco_automation::RejectBlueprint::new(self.inner.clone())
    }

    /// List blueprint revisions of a given blueprint.
    pub fn list_blueprint_revisions(
        &self,
    ) -> super::builder::telco_automation::ListBlueprintRevisions {
        super::builder::telco_automation::ListBlueprintRevisions::new(self.inner.clone())
    }

    /// Searches across blueprint revisions.
    pub fn search_blueprint_revisions(
        &self,
    ) -> super::builder::telco_automation::SearchBlueprintRevisions {
        super::builder::telco_automation::SearchBlueprintRevisions::new(self.inner.clone())
    }

    /// Searches across deployment revisions.
    pub fn search_deployment_revisions(
        &self,
    ) -> super::builder::telco_automation::SearchDeploymentRevisions {
        super::builder::telco_automation::SearchDeploymentRevisions::new(self.inner.clone())
    }

    /// Discards the changes in a blueprint and reverts the blueprint to the last
    /// approved blueprint revision. No changes take place if a blueprint does not
    /// have revisions.
    pub fn discard_blueprint_changes(
        &self,
    ) -> super::builder::telco_automation::DiscardBlueprintChanges {
        super::builder::telco_automation::DiscardBlueprintChanges::new(self.inner.clone())
    }

    /// Lists the blueprints in TNA's public catalog. Default page size = 20,
    /// Max Page Size = 100.
    pub fn list_public_blueprints(&self) -> super::builder::telco_automation::ListPublicBlueprints {
        super::builder::telco_automation::ListPublicBlueprints::new(self.inner.clone())
    }

    /// Returns the requested public blueprint.
    pub fn get_public_blueprint(&self) -> super::builder::telco_automation::GetPublicBlueprint {
        super::builder::telco_automation::GetPublicBlueprint::new(self.inner.clone())
    }

    /// Creates a deployment.
    pub fn create_deployment(&self) -> super::builder::telco_automation::CreateDeployment {
        super::builder::telco_automation::CreateDeployment::new(self.inner.clone())
    }

    /// Updates a deployment.
    pub fn update_deployment(&self) -> super::builder::telco_automation::UpdateDeployment {
        super::builder::telco_automation::UpdateDeployment::new(self.inner.clone())
    }

    /// Returns the requested deployment.
    pub fn get_deployment(&self) -> super::builder::telco_automation::GetDeployment {
        super::builder::telco_automation::GetDeployment::new(self.inner.clone())
    }

    /// Removes the deployment by marking it as DELETING. Post which deployment and
    /// it's revisions gets deleted.
    pub fn remove_deployment(&self) -> super::builder::telco_automation::RemoveDeployment {
        super::builder::telco_automation::RemoveDeployment::new(self.inner.clone())
    }

    /// List all deployments.
    pub fn list_deployments(&self) -> super::builder::telco_automation::ListDeployments {
        super::builder::telco_automation::ListDeployments::new(self.inner.clone())
    }

    /// List deployment revisions of a given deployment.
    pub fn list_deployment_revisions(
        &self,
    ) -> super::builder::telco_automation::ListDeploymentRevisions {
        super::builder::telco_automation::ListDeploymentRevisions::new(self.inner.clone())
    }

    /// Discards the changes in a deployment and reverts the deployment to the last
    /// approved deployment revision. No changes take place if a deployment does
    /// not have revisions.
    pub fn discard_deployment_changes(
        &self,
    ) -> super::builder::telco_automation::DiscardDeploymentChanges {
        super::builder::telco_automation::DiscardDeploymentChanges::new(self.inner.clone())
    }

    /// Applies the deployment's YAML files to the parent orchestration cluster.
    pub fn apply_deployment(&self) -> super::builder::telco_automation::ApplyDeployment {
        super::builder::telco_automation::ApplyDeployment::new(self.inner.clone())
    }

    /// Returns the requested deployment status.
    pub fn compute_deployment_status(
        &self,
    ) -> super::builder::telco_automation::ComputeDeploymentStatus {
        super::builder::telco_automation::ComputeDeploymentStatus::new(self.inner.clone())
    }

    /// Rollback the active deployment to the given past approved deployment
    /// revision.
    pub fn rollback_deployment(&self) -> super::builder::telco_automation::RollbackDeployment {
        super::builder::telco_automation::RollbackDeployment::new(self.inner.clone())
    }

    /// Returns the requested hydrated deployment.
    pub fn get_hydrated_deployment(
        &self,
    ) -> super::builder::telco_automation::GetHydratedDeployment {
        super::builder::telco_automation::GetHydratedDeployment::new(self.inner.clone())
    }

    /// List all hydrated deployments present under a deployment.
    pub fn list_hydrated_deployments(
        &self,
    ) -> super::builder::telco_automation::ListHydratedDeployments {
        super::builder::telco_automation::ListHydratedDeployments::new(self.inner.clone())
    }

    /// Updates a hydrated deployment.
    pub fn update_hydrated_deployment(
        &self,
    ) -> super::builder::telco_automation::UpdateHydratedDeployment {
        super::builder::telco_automation::UpdateHydratedDeployment::new(self.inner.clone())
    }

    /// Applies a hydrated deployment to a workload cluster.
    pub fn apply_hydrated_deployment(
        &self,
    ) -> super::builder::telco_automation::ApplyHydratedDeployment {
        super::builder::telco_automation::ApplyHydratedDeployment::new(self.inner.clone())
    }

    /// Lists information about the supported locations for this service.
    pub fn list_locations(&self) -> super::builder::telco_automation::ListLocations {
        super::builder::telco_automation::ListLocations::new(self.inner.clone())
    }

    /// Gets information about a location.
    pub fn get_location(&self) -> super::builder::telco_automation::GetLocation {
        super::builder::telco_automation::GetLocation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn list_operations(&self) -> super::builder::telco_automation::ListOperations {
        super::builder::telco_automation::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn get_operation(&self) -> super::builder::telco_automation::GetOperation {
        super::builder::telco_automation::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn delete_operation(&self) -> super::builder::telco_automation::DeleteOperation {
        super::builder::telco_automation::DeleteOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: longrunning::client::Operations
    pub fn cancel_operation(&self) -> super::builder::telco_automation::CancelOperation {
        super::builder::telco_automation::CancelOperation::new(self.inner.clone())
    }
}
